#include<iostream>

using namespace std;
using ll = long long;
ll n, k;
int main()
{
    cin >> n >> k;
    ll x = n % k, y = n / k;
    if (x == 0) cout << k << endl;
    else cout << k - x << endl;
    return 0;
}